package forces;

import java.awt.Dimension;

import simulation.Mass;
import util.Location;
import util.Vector;

/**
 * defines a repulsion force from the right wall.
 * @author Schwartz & Roy
 *
 */
public class RightWallForce extends WallForce {

    /**
     * default constructor.
     */
    public RightWallForce() {
        super();
    }

    /**
     * constructor sets wallID to 2.
     * @param magnitude is the magnitude of the force
     * @param exponent is the exponent of the force
     */
    public RightWallForce(double magnitude, double exponent) {
        super(magnitude, exponent);
    }

    /**
     * @return the force vector from the right wall.
     */
    @Override
    public Vector getForceVector(Location massLocation, Dimension bounds) {
        if (isOn()) {
            return new Vector(Mass.LEFT_DIRECTION, getMagnitude() /
                    (Math.pow(getSafeDistance(bounds.getWidth()-
                            massLocation.getX()), getExponent())));
        }
        return new Vector();
    }

}
